<template>
  <div>
    <!-- 底部部分 -->
    <footer class="footer">
      <span class="todo-count"
        ><strong>{{ sum }}</strong
        >剩余</span
      >
      <ul class="filters">
        <li>
          <a
            :class="{ selected: type === 'all' }"
            @click="changeType('all')"
            href="#/"
            >全部</a
          >
        </li>
        <li>
          <a
            :class="{ selected: type === 'active' }"
            @click="changeType('active')"
            href="#/active"
            >进行中</a
          >
        </li>
        <li>
          <a
            :class="{ selected: type === 'completed' }"
            @click="changeType('completed')"
            href="#/completed"
            >已完成</a
          >
        </li>
      </ul>
      <button class="clear-completed" @click="delBtn" v-show="showBtn">
        清除已完成
      </button>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'ListFooter',
  props: {
    sum: {
      type: Number,
      required: true,
    },

    type: {
      type: String,
      required: true,
    },
    
    showBtn: {
      type: Boolean,
      required: true,
    },
  },
  data() {
    return {}
  },

  methods: {
    changeType(type) {
      this.$emit('changeType', type)
    },

    delBtn() {
      this.$emit('delBtn')
    },
  },
}
</script>

<style scoped></style>
